import 'package:fish_redux/fish_redux.dart';

import 'action.dart';
import 'state.dart';

Reducer<LoginFormState> buildReducer() {
  return asReducer(
    <Object, Reducer<LoginFormState>>{
      LoginFormAction.submitting: _submitting,
    },
  );
}

LoginFormState _submitting(LoginFormState state, Action action) {
  final LoginFormState newState = state.clone();
  final bool payload = action.payload ?? false;

  newState.submitting = payload;

  return newState;
}
